package com.secondary.interceptor;



import java.util.Map;

import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
import com.secondary.pojos.User;

public class LoginInterceptor extends AbstractInterceptor{

	@Override
	public String intercept(ActionInvocation invocation) throws Exception {
		ActionContext ctx = invocation.getInvocationContext();  
        Map session = ctx.getSession();  
        User user = (User) session.get("user");  
        if(user!=null){
        	return invocation.invoke(); 
        }
		return Action.LOGIN;
	}
	
}
